// JavaScript Document
loadstatustext = 'Loading...';
function ajaxLoad(url,id)
   {
       if (document.getElementById) {
           var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
           }
           if (x)
               {
           x.onreadystatechange = function()
                   {
                       el = document.getElementById(id);
                       el.innerHTML = loadstatustext;
               if (x.readyState == 4 && x.status == 200)
                       {
                       el.innerHTML = x.responseText;
                   }
                   }
               x.open("GET", url, true);
               x.send(null);
               }
       }
function pb_display(url,id)       
		{
			ajaxLoad(url,id);
		}


function process_post_method(url,id,hidden_button)
{
	var txtf_ctitle=document.getElementById("txtf_ctitle").value;
	var cbof_nid_cat_news=document.getElementById("cbof_nid_cat_news").value;
	var cbof_nid_sec_news=document.getElementById("cbof_nid_sec_news").value;

	var txt_row_per_page=document.getElementById("txt_row_per_page").value;	
	var txt_current_page=document.getElementById("txt_current_page").value;	

	var param 		= 'txt_row_per_page='+txt_row_per_page+'&&hidden_button='+hidden_button+'&&txt_current_page='+txt_current_page+'&&txtf_ctitle='+txtf_ctitle+'&&cbof_nid_cat_news='+cbof_nid_cat_news+'&&cbof_nid_sec_news='+cbof_nid_sec_news;

	var obj_ajax 	= tkb_getXmlHttpRequestObject();

	if (obj_ajax.readyState == 4 || obj_ajax.readyState  == 0) 
	{			
		obj_ajax.open("POST",url, true);
		obj_ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		obj_ajax.onreadystatechange = function(){
				if(obj_ajax.readyState == 4 && obj_ajax.status == 200)
				{
					obj_change = document.getElementById(id);	
					response_ajax		= obj_ajax.responseText;
					obj_change.innerHTML 	= response_ajax;
				}
	}	
		obj_ajax.send(param);
	}			

}

function process_post_method_product(url,id,hidden_button)
{
	var txtf_cproduct=document.getElementById("txtf_cproduct").value;
	var cbof_nid_cat_product=document.getElementById("cbof_nid_cat_product").value;	
	var cbof_nid_sec_product=document.getElementById("cbof_nid_sec_product").value;

	var txt_row_per_page_product=document.getElementById("txt_row_per_page_product").value;	
	var txt_current_page_product=document.getElementById("txt_current_page_product").value;	

	var param 		= 'txt_row_per_page_product='+txt_row_per_page_product+'&&hidden_button='+hidden_button+'&&txt_current_page_product='+txt_current_page_product+'&&txtf_cproduct='+txtf_cproduct+'&&cbof_nid_cat_product='+cbof_nid_cat_product+'&&cbof_nid_sec_product='+cbof_nid_sec_product;

	var obj_ajax 	= tkb_getXmlHttpRequestObject();

	if (obj_ajax.readyState == 4 || obj_ajax.readyState  == 0) 
	{			
		obj_ajax.open("POST",url, true);
		obj_ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		obj_ajax.onreadystatechange = function(){
				if(obj_ajax.readyState == 4 && obj_ajax.status == 200)
				{
					obj_change = document.getElementById(id);	
					response_ajax		= obj_ajax.responseText;
					obj_change.innerHTML 	= response_ajax;
				}
	}	
		obj_ajax.send(param);
	}			

}

function tkb_getXmlHttpRequestObject() 
{	
	if (window.XMLHttpRequest) 
	{ // Mozilla, Safari,...
		return new XMLHttpRequest();		
	} 
	else if (window.ActiveXObject) 
	{ // IE
		try
		{
			return new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
			{
				return new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				alert('Cannot create XMLHTTP instance');
				return false;
			}
		}
	}

}
